
        
package com.mall.order.controller;

import com.mall.order.constants.SysConstant;
import com.ctg.mse.common.model.result.ResultGeneralModel;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.web.bind.annotation.*;
import com.mall.order.service.MysqlDemoService;

        import com.mall.order.service.RedisDemoService;

/**
 * @Description: 普通HTTP服务
 * @Author: zhouzhao
 * @CreateTime: 2022/10/19 10:38:29
 */
@RestController
@RefreshScope//设置nacos配置项为自动刷新
public class DemoController {

    private static final Logger LOGGER = LoggerFactory.getLogger(DemoController.class);

    //可使用简单的@Value注解获取nacos配置
    @Value("${configTest:def}")
    private String nacosConfig;

        @Autowired
    private MysqlDemoService mysqlDemoService;
    
        @Autowired
    private RedisDemoService redisDemoService;
    
    @GetMapping(SysConstant.BASE_URL + "/DemoController/test")
    public ResultGeneralModel<String> test(@RequestParam(name = "echo") String echo) {
        return ResultGeneralModel.newSuccess(echo + " resp");
    }

    @GetMapping(SysConstant.BASE_URL + "/DemoController/testNacosConfig")
    public String testNacosConfig() {
        return nacosConfig;
    }

}
